<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>target伪类示例</title>
    <style type="text/css">
        .tab div {
            display: none;
        }
        .tab div:target {
            display: block;
            border: 2px solid darkorange;
            background-color: beige;
        }
    </style>
</head>
<body>
    <h1>:target伪类演示</h1>
    <div class="tab">
        <a href="#link1">链接1</a>
        <a href="#link2">链接2</a>
        <a href="#link3">链接3</a>
        <div id="link1">
            <h3>链接1的内容</h3>
            <p>你好，世界!</p>
        </div>
        <div id="link2">
            <h3>链接2的内容</h3>
            <h4>非常成功</h4>
        </div>
        <div id="link3">
            <h3>链接3的内容</h3>
            <p>耶！</p>
        </div>
    </div>
</body>
</html>